// 用户相关的接口
import request from '@/utils/request'
import { getStorage } from '@/utils/storage.js'
// 登录
export const Login = (obj) => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data: obj,
  })
}

// 当token过期 续签刷新token值
export const refreshToken = () => {
  return request({
    method: 'PUT',
    url: '/v1_0/authorizations',
    headers: {
      Authorization: 'Bearer ' + getStorage('refresh_token'),
    },
  })
}

// 获取用户个人简介
export const getUserbriefly = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/profile',
  })
}

// 获取用户基本资料
export const getUsermaterials = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user',
  })
}

// 更新用户头像
export const UpdateUsertx = (fd) => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data: fd,
  })
}

// 更新用户个人简介
export const UpdateUserbriefly = (obj) => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/profile',
    data: obj,
  })
}
